<?php
class Student{
    private $name;
    //构造函数
    public function __construct($name) {
        $this->name=$name;
        echo "{$name}出生了<br>";
    }
    //析构函数
    public function __destruct() {
        echo "{$this->name}销毁了<br>";
    }
}

//测试
$stu1=new Student('tom');
$stu2=new Student('berry');
$stu3=new Student('ketty');
echo "<hr>";
?>